package com.yunhe.common.constant;

/**
 * @ClassName InSpectConsts
 * @Description TODO
 * @Author HeTao
 * @Date 2021/11/9 15:39
 * @Version 1.0
 **/
public class InSpectConsts {

    //项目题型
    public enum Item_Type {
        SingleChoice("01", "单选"),
        FillBlanks("02","填空");
        private String value;
        private String title;
        Item_Type(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public static String getTitleByValue(String value){
            Item_Type[] itemPlanTypes = values();
            for (Item_Type itemPlanType : itemPlanTypes){
                if (itemPlanType.value.equals(value)){
                    return itemPlanType.title;
                }
            }
            return null;
        }
    }

    //巡检状态
    public enum Inspect_Status {
        Finish("01", "已完成"),
        ToBeInspected("02","待巡检"),
        ToBeReview("03","待复审");
        private String value;
        private String title;
        Inspect_Status(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public static String getTitleByValue(String value){
            Inspect_Status[] inspectStatuses = values();
            for (Inspect_Status inspectStatus : inspectStatuses){
                if (inspectStatus.value.equals(value)){
                    return inspectStatus.title;
                }
            }
            return null;
        }
    }

    //整改单期限状态
    public enum Rectification_Status {
        Normal("0", "正常"),
        Expiring("1","即将到期"),
        TimedOut("2","已超时");
        private String value;
        private String title;
        Rectification_Status(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public static String getTitleByValue(String value){
            Rectification_Status[] rectificationStatus = values();
            for (Rectification_Status rectificationStatu : rectificationStatus){
                if (rectificationStatu.value.equals(value)){
                    return rectificationStatu.title;
                }
            }
            return null;
        }
    }


    // 短信模板代码定义
    public enum InspectPlanCycleStatus {
        NotStarted("01", "未开始"),
        HaveInHand("02", "进行中"),
        HasEnded("03", "已经结束"),
        ;
        private String value;
        private String title;
        InspectPlanCycleStatus(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public static String getTitle(String value) {
            InSpectConsts.InspectPlanCycleStatus[] values = values();
            for (InSpectConsts.InspectPlanCycleStatus customConfiguration : values) {
                if(customConfiguration.value().equals(value)){
                    return customConfiguration.title();
                }
            }
            return null;
        }

        public boolean equals(String value) {
            return this.value().equals(value);
        }
        public static InspectPlanCycleStatus byValue(String value) {
            InspectPlanCycleStatus[] values = InspectPlanCycleStatus.values();
            for (InspectPlanCycleStatus item : values) {
                if (item.equals(value)) {
                    return item;
                }
            }
            return null;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    public enum InspectPlanCycle{
        Month("01", "按月"),
        Day("02", "按天"),
        Week("03", "按周"),
        Season("04", "按季"),
        Year("05", "按年"),
        ;
        private String value;
        private String title;
        InspectPlanCycle(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public boolean equals(String value) {
            return this.value().equals(value);
        }
        public static InspectPlanCycle byValue(String value) {
            InspectPlanCycle[] values = InspectPlanCycle.values();
            for (InspectPlanCycle item : values) {
                if (item.equals(value)) {
                    return item;
                }
            }
            return null;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    public enum FormStatus{
        HasEnded("01", "已完成"),
        Beoverdue("02", "已过期"),
        ;
        private String value;
        private String title;
        FormStatus(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public boolean equals(String value) {
            return this.value().equals(value);
        }
        public static FormStatus byValue(String value) {
            FormStatus[] values = FormStatus.values();
            for (FormStatus item : values) {
                if (item.equals(value)) {
                    return item;
                }
            }
            return null;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }
}
